<?php 
header("content-type:text/html;charset=utf8");
$goods_id = isset($_GET['goods_id'])?$_GET['goods_id']:1;
$redis = new Redis();$redis->connect('127.0.0.1','6379');
$pdo = new PDO("mysql:host=127.0.0.1;charset=utf8;dbname=liu",'root','root');
$data = $pdo->query("select * from goods_order")->fetchall(PDO::FETCH_ASSOC);
$time = date("Y-m-d H:i:s");
$order_id ="FDGMFV".rand(1000,9999);
$res = $pdo->exec("insert into goods_order values('','$order_id','$goods_id','$time')");
if ($res) {
	$arr = array('code'=>1,'msg'=>"订单已生成");
}
else{
	$arr = array('code'=>0,'msg'=>"订单出错");

}
echo json_encode($arr);


 ?>